﻿<UserControl x:Class="Samba.Modules.MenuModule.PriceListView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:DataGridFilterLibrary="clr-namespace:DataGridFilterLibrary;assembly=DataGridFilterLibrary" mc:Ignorable="d" d:DesignHeight="300"
     d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <DataGrid Name="DataGrid" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Items}"
            AutoGenerateColumns="False" RowHeaderWidth="0" HorizontalAlignment="Left" HorizontalGridLinesBrush="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}"
            VerticalGridLinesBrush="{StaticResource {x:Static SystemColors.ActiveBorderBrushKey}}"
            CanUserDeleteRows="False"
            CanUserAddRows="False"
            VerticalScrollBarVisibility="Auto"
            HorizontalScrollBarVisibility="Auto"
            Background="{StaticResource {x:Static SystemColors.WindowBrushKey}}"
            ColumnHeaderStyle="{StaticResource {ComponentResourceKey 
            TypeInTargetAssembly={x:Type DataGridFilterLibrary:DataGridHeaderFilterControl}, 
            ResourceId=DataGridHeaderFilterControlStyle}}" FrozenColumnCount="3"
            CellEditEnding="DataGrid_CellEditEnding">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{LocText Product}"
                     IsReadOnly="True" MinWidth="170" Binding="{Binding ItemName}" />
                <DataGridTextColumn Header="{LocText Portion}"
                     IsReadOnly="True" Binding="{Binding Path=PortionName}" />
                <DataGridTextColumn Header="{LocText Price}"
                     MinWidth="60" Binding="{Binding Path=Price,StringFormat='#,#0.00'}" CellStyle="{StaticResource RightAlignedCellStyle}" />
            </DataGrid.Columns>
            <DataGrid.Resources>
                <Style TargetType="DataGridRow">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=IsChanged}" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.Resources>
        </DataGrid>
        <Button HorizontalAlignment="Left" Margin="0,10,0,5" Width="60" Grid.Column="0" Grid.Row="1"
             Command="{Binding SaveCommand}" Content="{Binding SaveCommand.Caption}" />
    </Grid>
</UserControl>